package com.qf.listener;

import com.qf.constant.RabbitMQConstants;
import com.qf.model.StandardSubmit;
import com.qf.service.SearchService;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author Zwnan
 */
@Component
public class SearchListener {

    @Autowired
    private SearchService logService;
    @RabbitListener(queues = RabbitMQConstants.TOPIC_SMS_SEND_LOG)
    public void saveLog(StandardSubmit submit, Message message, Channel channel) throws Exception {
        logService.saveLog(submit);
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);

    }


}
